/*
 * #depends subsonic-musicviewcardpanel.js
 */
Ext.ux.mattgoldspink.BottomBar = Ext.extend(Ext.Toolbar, {
    constructor: function(config){
        Ext.apply(this, config, {
            ui: 'light',
            dock: 'bottom',
            cls: 'bottom-bar',
            layout: {
                pack: 'center'
            },
            items: this.makeButtonGroup()
         });
         Ext.ux.mattgoldspink.BottomBar.superclass.constructor.call(this, config);
    },
    makeButtonGroup: function(){
        this.buttonGroup = [
            {
                xtype: 'segmentedbutton',
                allowDepress: true,
                items: [
                    {
                        text: 'Songs',
                        handler: this.handleSongsClick,
                        pressed: true
                    }, {
                        text: 'Artists',
                        handler: this.handleArtistsClick
                    }, {
                        text: 'Albums',
                        handler: this.handleAlbumsClick
                    }
                ]
            }
        ];
        return this.buttonGroup;
    },
    handleSongsClick: function(){
        Ext.getCmp('Ext.ux.mattgoldspink.MusicViewCardPanel').setActiveItem(0);
    },
    handleArtistsClick: function(){
        Ext.getCmp('Ext.ux.mattgoldspink.MusicViewCardPanel').setActiveItem(1);
    },
    handleAlbumsClick: function(){
        Ext.getCmp('Ext.ux.mattgoldspink.MusicViewCardPanel').setActiveItem(2);
    }    
});
